package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.huashigang.HuaShiGangModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Author wpj
 * @Date 2020/10/17
 */
@Cmd(code = GameProtocol.S_HUA_SHI_GANG_NOTIFY_SHOP_FROM_CROSS, desc = "花石纲系统通知")
public class HuaShiGangNotifyShopEventCmd extends AbstractCommand {

    int stat;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.HuaShiGangNotifyGameServerShop msg = HuaShiGangProto.HuaShiGangNotifyGameServerShop.parseFrom(packet.getBytes());
        stat = msg.getStat();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if (stat == 0) {
            player.getModule(HuaShiGangModule.class).notifyShopEvent();
        } else {
            player.getModule(HuaShiGangModule.class).giveUpShopEvent();
        }

    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
